package com.woniu.p2p.controller;

import com.github.pagehelper.PageInfo;
import com.woniu.p2p.entity.Show;
import com.woniu.p2p.service.P2PShowService;
import com.woniu.p2p.vo.ShowVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 86152
 * @create 2020/8/7
 * @since 1.0.0
 */
@RestController
@RequestMapping("/show")
public class P2PShowController {

    @Autowired
    P2PShowService p2PShowService;

    @RequestMapping("/getShowList")
    public PageInfo<Show> getshowList(){
        int start=1;
        int size=7;
        PageInfo<Show> showPageInfo=p2PShowService.findAll("",start,size);
        return showPageInfo;
    }

    @RequestMapping("/getSinglePage")
    public PageInfo<Show> findSinglePage(@RequestBody ShowVo showVo){
        System.out.println(showVo.getPageNum());
        int start=showVo.getPageNum();
        int size=7;
        PageInfo<Show> showPageInfo = p2PShowService.findAll("", start, size);
        return showPageInfo;
    }

    @RequestMapping("/getSingleList")
    public Show fingSingleShow(@RequestBody Show show){
        Show findshow=p2PShowService.findShowById(show.getShowId());
        return findshow;
    }
}
